import { ref } from "vue";
import type { AvueFormOption } from "@smallwei/avue";

export default function () {
  const option: AvueFormOption = {
    menuBtn: false,
    labelWidth: 110,
    column: [
      {
        prop: "dictName",
        label: "字典名称",
        rules: [
          {
            required: true,
            message: "请输入字典名称",
          },
        ],
      },
      {
        prop: "dictType",
        label: "字典类型",
        rules: [
          {
            required: true,
            message: "请输入字典类型",
          },
        ],
      },
      {
        type: "select",
        prop: "status",
        label: "字典状态",
        dicUrl: "/api/system/dict/type/optionSelect/sys_status",
        props: {
          label: "dictLabel",
          value: "dictValue",
        },
      },
      {
        prop: "remark",
        label: "备注",
      },
      {
        type: "dynamic",
        prop: "dictData",
        label: "字典数据",
        span: 24,
        children: {
          align: "center",
          headerAlign: "center",
          column: [
            {
              label: "字典label",
              prop: "dictLabel",
              rules: [
                {
                  required: true,
                  message: "请输入字典label",
                },
              ],
            },
            {
              label: "字典value",
              prop: "dictValue",
              rules: [
                {
                  required: true,
                  message: "请输入字典value",
                },
              ],
            },
            {
              type: "select",
              prop: "status",
              label: "是否启用",
              value: "1",
              dicData: [
                {
                  label: "启用",
                  value: "1",
                },
                {
                  label: "禁用",
                  value: "0",
                },
              ],
            },
          ],
        },
      },
    ],
  };
  return ref(option);
}
